<template>
  <el-button @click="exportWord">打印文件</el-button>
</template>

<script>
import Docxtemplater from 'docxtemplater'
import PizZip from 'pizzip'
import JSZipUtils from 'jszip-utils'
import {saveAs} from 'file-saver'
import html2Canvas from 'html2canvas'
import JsPDF from 'jspdf'
import * as XLSX from 'xlsx'
import * as ExcelJS from 'exceljs';
//批准书
export function export_word_1(      evi_id_number,
                                    illegal_behavior,
                                    mer_person,
                                    year,
                                    month,
                                    day,
                                    user_name_1,
                                    user_name_2,
                                    tce_type_number,
                                    tce_number,
                                    tce_address,
                                    list){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/批准书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);
    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      evi_id_number:evi_id_number,
      illegal_behavior:illegal_behavior,
      mer_person:mer_person,
      year:year,
      month:month,
      day:day,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      tce_type_number:tce_type_number,
      tce_number:tce_number,
      tce_address:tce_address,
      list:list
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, evi_id_number + "-证据先行保存批准书.docx");
  });
}
//喷码明细表
export function export_word_2(      //case_id,
                                    evi_id_number,
                                    mer_person,
                                    year,
                                    user_name_1,
                                    user_name_2,
                                    tce_type_number,
                                    tce_number,
                                    list){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/涉案卷烟喷码明细表.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);
    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      evi_id_number:evi_id_number,
      mer_person:mer_person,
      year:year,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      tce_type_number:tce_type_number,
      tce_number:tce_number,
      list:list
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, evi_id_number + "-涉案卷烟喷码明细表.docx");
  });
}



//立案报告表打印
export function export_word_3(      year,
                                    case_number,
                                    list1,
                                    case_source,
                                    month,
                                    day,
                                    hour,
                                    min,
                                    mer_address,
                                    tir_person,
                                    retail_licence_code,
                                    tir_id_number,
                                    mer_hometown,
                                    area_name,
                                    mer_name,
                                    list2,
                                    tce_type_number_chinese,
                                    tce_number_chinese,
                                    list3,
                                    violate_law,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/立案报告.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    console.log(tir_id_number)
    doc.setData({
      year:year,
      case_number:case_number,
      list1:list1,
      case_source:case_source,
      month:month,
      day:day,
      hour:hour,
      min:min,
      mer_address:mer_address,
      tir_person:tir_person,
      retail_licence_code:retail_licence_code,
      tir_id_number:tir_id_number,
      mer_hometown:mer_hometown,
      area_name:area_name,
      mer_name:mer_name,
      list2:list2,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      list3:list3,
      violate_law:violate_law
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number + "-立案报告.docx");
  });
}
//卷烟鉴别书打印
export function export_word_4(
    year,
    staff_evi_send_unit,
    staff_evi_send_per,
    staff_evi_check_per1,
    staff_evi_check_per2,
    staff_identity_license_no_1,
    staff_identity_license_no_2,
    staff_evi_per_note,
    case_source,
    month,
    day,
    hour,
    ciga_data_t,
    ciga_data_f,
    tir_person,
    tir_id_number,
    mer_address,
    mer_person,
    retail_licence_code,
    area_name,
    mer_name,
    list2,
    tce_type_number_chinese,
    tce_number_chinese,
    list3,
    year1,
    month1,
    day1,
    year2,
    month2,
    day2,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/卷烟鉴别.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);
    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      staff_evi_send_unit:staff_evi_send_unit,
      staff_evi_send_per:staff_evi_send_per,
      staff_evi_check_per1:staff_evi_check_per1,
      staff_evi_check_per2:staff_evi_check_per2,
      staff_identity_license_no_1:staff_identity_license_no_1,
      staff_identity_license_no_2:staff_identity_license_no_2,
      staff_evi_per_note:staff_evi_per_note,
      case_source:case_source,
      month:month,
      day:day,
      hour:hour,
      ciga_data_t:ciga_data_t,
      ciga_data_f:ciga_data_f,
      tir_person:tir_person,
      tir_id_number:tir_id_number,
      mer_address:mer_address,
      mer_person:mer_person,
      retail_licence_code:retail_licence_code,
      area_name:area_name,
      mer_name:mer_name,
      list2:list2,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      list3:list3,
      year1:year1,
      month1:month1,
      day1:day1,
      year2:year2,
      month2:month2,
      day2:day2,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out,mer_name + "-卷烟鉴别.docx");
  });
}


export function export_word_5(      year,
                                    case_number,
                                    list1,
                                    case_source,
                                    month,
                                    day,
                                    hour,
                                    min,
                                    mer_address,
                                    mer_person,
                                    retail_licence_code,
                                    mer_id_number,
                                    mer_hometown,
                                    area_name,
                                    mer_name,
                                    list2,
                                    tce_type_number,
                                    tce_number,
                                    list3,
                                    year1,
                                    month1,
                                    day1,
                                    year2,
                                    month2,
                                    day2,
                                    year3,
                                    month3,
                                    day3,
                                    single_total,
                                    tce_amount
){

  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/核价表.docx", function(error, content ) {

    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容

    let zip = new PizZip(content);
    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      case_number:case_number,
      list1:list1,
      case_source:case_source,
      month:month,
      day:day,
      hour:hour,
      min:min,
      mer_address:mer_address,
      mer_person:mer_person,
      retail_licence_code:retail_licence_code,
      mer_id_number:mer_id_number,
      mer_hometown:mer_hometown,
      area_name:area_name,
      mer_name:mer_name,
      list2:list2,
      tce_type_number:tce_type_number,
      tce_number:tce_number,
      list3:list3,
      year1:year1,
      month1:month1,
      day1:day1,
      year2:year2,
      month2:month2,
      day2:day2,
      year3:year3,
      month3:month3,
      day3:day3,
      tce_amount:tce_amount,
      single_total:single_total
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    //alert(out)
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number + "-涉案卷烟核价表.docx");
  });
}

//询问笔录打印
export function export_word_6(
        inquiry_time,
        tce_address,
        user_id_1,
        user_id_2,
        user_name_1,
        user_name_2,
        recorder,
        staff_license_1,
        staff_license_2,
        tir_person,
        tir_gender,
        tir_nation,
        tir_id_number,
        tir_home,
        address,
        tel,
        confirm_record,
        inform_right,
        tir_person_answer,
        question_answer_list,
        end_confirm
) {
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/询问笔录.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      inquiry_time:inquiry_time,
      tce_address:tce_address,
      user_id_1:user_id_1,
      user_id_2:user_id_2,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      recorder:recorder,
      staff_license_1:staff_license_1,
      staff_license_2:staff_license_2,
      tir_person:tir_person,
      tir_gender:tir_gender,
      tir_nation:tir_nation,
      tir_id_number:tir_id_number,
      tir_home:tir_home,
      address:address,
      tel:tel,
      confirm_record:confirm_record,
      inform_right:inform_right,
      tir_person_answer:tir_person_answer,
      question_answer_list:question_answer_list,
      end_confirm:end_confirm,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "询问笔录.docx");
  });
}



//调查终结文书打印
export function export_word_7(      year,
                                    case_number,
                                    list1,
                                    case_source,
                                    month,
                                    day,
                                    hour,
                                    min,
                                    mer_address,
                                    tir_person,
                                    user_name_1,
                                    user_name_2,
                                    user_id_1,
                                    user_id_2,
                                    tir_id_number,
                                    tel,
                                    evi_ciga_f,
                                    evi_ciga_t,
                                    ciga_amount_f,
                                    ciga_amount_t,
                                    tce_amount_chinese,
                                    tce_amount,
                                    retail_licence_code,
                                    mer_id_number,
                                    mer_hometown,
                                    area_name,
                                    mer_name,
                                    list2,
                                    tce_type_number,
                                    tce_type_number_chinese,
                                    tce_number,
                                    list3,
                                    list4,
                                    list5,
                                    list6,
                                    list7,
                                    list8,
                                    illegal_behavior,
                                    punish_basis,
                                    cigarette_origin,
                                    violate_law,
                                    tce_number_chinese,

){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/调查终结.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      case_number:case_number,
      list1:list1,
      case_source:case_source,
      month:month,
      day:day,
      hour:hour,
      min:min,
      mer_address:mer_address,
      tir_person:tir_person,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      user_id_1:user_id_1,
      user_id_2:user_id_2,
      tir_id_number:tir_id_number,
      tel:tel,
      evi_ciga_f:evi_ciga_f,
      evi_ciga_t:evi_ciga_t,
      ciga_amount_f:ciga_amount_f,
      ciga_amount_t:ciga_amount_t,
      tce_amount_chinese:tce_amount_chinese,
      tce_amount:tce_amount,
      retail_licence_code:retail_licence_code,
      mer_id_number:mer_id_number,
      mer_hometown:mer_hometown,
      area_name:area_name,
      mer_name:mer_name,
      list2:list2,
      tce_type_number:tce_type_number,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number:tce_number,
      list3:list3,
      list4:list4,
      list5:list5,
      list6:list6,
      list7:list7,
      list8:list8,
      illegal_behavior:illegal_behavior,
      punish_basis:punish_basis,
      cigarette_origin:cigarette_origin,
      violate_law:violate_law,
      tce_number_chinese:tce_number_chinese,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-调查终结.docx");
  });
}

//打印先行登记保存物品处理通知书
export function export_word_8(case_id,
        tir_person,
        mer_person,
        illegal_behavior,
        case_number,
        date_of_filing1,
        year1,
        month1,
        day1,
        date_of_filing2,
        year2,
        month2,
        day2,
        date_of_filing3,
        year3,
        month3,
        day3,
        evi_id_number,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/先行登记保存物品处理通知书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      case_id:case_id,
      tir_person:tir_person,
      mer_person:mer_person,
      illegal_behavior:illegal_behavior,
      case_number:case_number,
      date_of_filing1:date_of_filing1,
      year1:year1,
      month1:month1,
      day1:day1,
      date_of_filing2:date_of_filing2,
      year2:year2,
      month2:month2,
      day2:day2,
      date_of_filing3:date_of_filing3,
      year3:year3,
      month3:month3,
      day3:day3,
      evi_id_number:evi_id_number,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-先行登记保存物品处理通知书.docx");
  });
}

//行政处罚事先告知书
export function export_word_9(
        tir_person,
        tir_id_number,
        tir_nation,
        tir_gender,
        tir_home,
        mer_hometown,
        retail_licence_code,
        illegal_behavior,
        case_number,
        date_of_filing,
        year,
        month,
        day,
        violate_law,
        bureau_penalty,
        user_id_1,
        user_id_2,
        user_name_1,
        user_name_2,
        staff_license_no1,
        staff_license_no2,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/行政处罚事先告知书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      tir_person:tir_person,
      tir_id_number:tir_id_number,
      tir_nation:tir_nation,
      tir_gender:tir_gender,
      tir_home:tir_home,
      mer_hometown:mer_hometown,
      retail_licence_code:retail_licence_code,
      illegal_behavior:illegal_behavior,
      case_number:case_number,
      date_of_filing:date_of_filing,
      year:year,
      month:month,
      day:day,
      violate_law:violate_law,
      bureau_penalty:bureau_penalty,
      user_id_1:user_id_1,
      user_id_2:user_id_2,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      staff_license_no1:staff_license_no1,
      staff_license_no2:staff_license_no2,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-行政处罚事先告知书.docx");
  });
}

//现场勘验笔录
export function export_word_10(
        year,
        month,
        day,
        hour,
        min,
        mer_address,
        mer_name,
        mer_person,
        tir_gender,
        tir_age,
        retail_licence_code,
        tir_id_number,
        tir_home,
        telephone_number,
        user_name_1,
        user_name_2,
        whether_retail_licence_code,
        list2,
        tce_type_number_chinese,
        tce_number_chinese,
        list3,
        staff_license_no1,
        staff_license_no2
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/检查(勘验)笔录.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      month:month,
      day:day,
      hour:hour,
      min:min,
      mer_address:mer_address,
      mer_name:mer_name,
      mer_person:mer_person,
      tir_gender:tir_gender,
      tir_age:tir_age,
      retail_licence_code:retail_licence_code,
      tir_id_number:tir_id_number,
      tir_home:tir_home,
      telephone_number:telephone_number,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      whether_retail_licence_code:whether_retail_licence_code,
      list2:list2,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      list3:list3,
      staff_license_no1:staff_license_no1,
      staff_license_no2:staff_license_no2,
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "检查（勘验）笔录.docx");
  });
}

//集体讨论
export function export_word_11(
        case_cause,
        year,
        case_number,
        tir_person,
        year1,
        month1,
        day1,
        hour1,
        min1,
        year2,
        month2,
        day2,
        hour2,
        min2,
        discuss_address,
        staff_host_name,
        host_degree,
        recorder_name,
        attend_person_all,
        sit_attend_person_all,
        list1,
        list2,
        year3,
        month3,
        day3,
        mer_address,
        mer_name,
        tce_type_number_chinese,
        tce_number_chinese,
        illegal_behavior,
        list3,
        cigarette_origin,
        list4,
        tce_type_number_t_chinese,
        tce_number_t_chinese,
        list5,
        tce_type_number_f_chinese,
        tce_number_f_chinese,
        tce_amount_chinese,
        tce_amount,
        num1,
        violate_law,
        list6,
        list7,
        list8,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/重大案件集体讨论记录.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      case_cause:case_cause,
      year:year,
      case_number:case_number,
      tir_person:tir_person,
      year1:year1,
      month1:month1,
      day1:day1,
      hour1:hour1,
      min1:min1,
      year2:year2,
      month2:month2,
      day2:day2,
      hour2:hour2,
      min2:min2,
      discuss_address:discuss_address,
      staff_host_name:staff_host_name,
      host_degree:host_degree,
      recorder_name:recorder_name,
      attend_person_all:attend_person_all,
      sit_attend_person_all:sit_attend_person_all,
      list1:list1,
      list2:list2,
      year3:year3,
      month3:month3,
      day3:day3,
      mer_address:mer_address,
      mer_name:mer_name,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      illegal_behavior:illegal_behavior,
      list3:list3,
      cigarette_origin:cigarette_origin,
      list4:list4,
      tce_type_number_t_chinese:tce_type_number_t_chinese,
      tce_number_t_chinese:tce_number_t_chinese,
      list5:list5,
      tce_type_number_f_chinese:tce_type_number_f_chinese,
      tce_number_f_chinese:tce_number_f_chinese,
      tce_amount_chinese:tce_amount_chinese,
      tce_amount:tce_amount,
      num1:num1,
      violate_law:violate_law,
      list6:list6,
      list7:list7,
      list8:list8,
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "集体讨论.docx");
  });
}

//听证告知书打印
export function export_word_12(
        illegal_behavior,
        tir_person,
        violate_law,
        penalty_decision,
        bureau_address,
        postal_code,
        telephone_number,
        undertaker1_name,
        undertaker2_name,
        staff_license_no1,
        staff_license_no2,
        year,
        month,
        day,
        year1,
        month1,
        day1,
        case_number
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/听证告知书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      illegal_behavior:illegal_behavior,
      tir_person:tir_person,
      violate_law:violate_law,
      penalty_decision:penalty_decision,
      bureau_address:bureau_address,
      postal_code:postal_code,
      telephone_number:telephone_number,
      undertaker1_name:undertaker1_name,
      undertaker2_name:undertaker2_name,
      staff_license_no1:staff_license_no1,
      staff_license_no2:staff_license_no2,
      year:year,
      month:month,
      day:day,
      year1:year1,
      month1:month1,
      day1:day1,
      case_number:case_number
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-听证告知书.docx");
  });
}

//听证告知书送回达证
export function export_word_13(
        year,
        case_number,
        arrive_document_name,
        arrive_number,
        addressee,
        arrive_place,
        service_mode,
        receipt_signature,
        year1,
        month1,
        day1,
        hour1,
        min1,
        year2,
        month2,
        day2,
        hour2,
        min2,
        subsitute_reason,
        witness_signature,
        staff_name1,
        staff_license_no1,
        staff_name2,
        staff_license_no2,
        remarks
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/送达回证.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      case_number:case_number,
      arrive_document_name:arrive_document_name,
      arrive_number:arrive_number,
      addressee:addressee,
      arrive_place:arrive_place,
      service_mode:service_mode,
      receipt_signature:receipt_signature,
      year1:year1,
      month1:month1,
      day1:day1,
      hour1:hour1,
      min1:min1,
      year2:year2,
      month2:month2,
      day2:day2,
      hour2:hour2,
      min2:min2,
      subsitute_reason:subsitute_reason,
      witness_signature:witness_signature,
      staff_name1:staff_name1,
      staff_license_no1:staff_license_no1,
      staff_name2:staff_name2,
      staff_license_no2:staff_license_no2,
      remarks:remarks
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "听证告知书送达回证.docx");
  });
}

//案件处理审批表
export function export_word_14(
        illegal_behavior,
        year,
        month,
        day,
        case_number,
        name,
        statutory_responsible_person,
        address,
        tel,
        tir_person,
        tir_gender,
        tir_nation,
        tir_id_number,
        retail_licence_code,
        tir_home,
        telephone_number,
        conspirator,
        mer_address,
        mer_name,
        tce_type_number_chinese,
        tce_number_chinese,
        year1,
        month1,
        day1,
        cigarette_origin,
        violate_law,
        num1,
        punish_basis,
        crime_number,
        tce_amount_chinese,
        tce_amount,
        discretionary_standard_name,
        discretionary_standard_grade,
        discretionary_standard_punish,
        penalty_decision,
        penalty_money,
        penalty_money_all,
        penalty_money_all_chinese,
        undertaker1_name,
        undertaker2_name,
        staff_license_no_1,
        staff_license_no_2,
        year2,
        month2,
        day2,
        tce_number_f_chinese,
        tce_number_t_chinese,
        list1,
        list2,
        list3,
        list4,
        list5,
        list6,
        list7,
        ciga_data_all,
        evi_data_all,
        evi_data_all_1,
        ciga_data_t,
        evi_ciga_t,
        ciga_data_f,
        evi_ciga_f,
        tce_type_number_t_chinese,
        tce_type_number_f_chinese,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/案件处理审批表.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      illegal_behavior:illegal_behavior,
      year:year,
      month:month,
      day:day,
      case_number:case_number,
      name:name,
      statutory_responsible_person:statutory_responsible_person,
      address:address,
      tel:tel,
      tir_person:tir_person,
      tir_gender:tir_gender,
      tir_nation:tir_nation,
      tir_id_number:tir_id_number,
      retail_licence_code:retail_licence_code,
      tir_home:tir_home,
      telephone_number:telephone_number,
      conspirator:conspirator,
      mer_address:mer_address,
      mer_name:mer_name,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      year1:year1,
      month1:month1,
      day1:day1,
      cigarette_origin:cigarette_origin,
      violate_law:violate_law,
      num1:num1,
      punish_basis:punish_basis,
      crime_number:crime_number,
      tce_amount_chinese:tce_amount_chinese,
      tce_amount:tce_amount,
      discretionary_standard_name:discretionary_standard_name,
      discretionary_standard_grade:discretionary_standard_grade,
      discretionary_standard_punish:discretionary_standard_punish,
      penalty_decision:penalty_decision,
      penalty_money:penalty_money,
      penalty_money_all:penalty_money_all,
      penalty_money_all_chinese:penalty_money_all_chinese,
      undertaker1_name:undertaker1_name,
      undertaker2_name:undertaker2_name,
      staff_license_no_1:staff_license_no_1,
      staff_license_no_2:staff_license_no_2,
      year2:year2,
      month2:month2,
      day2:day2,
      tce_number_f_chinese:tce_number_f_chinese,
      tce_number_t_chinese:tce_number_t_chinese,
      list1:list1,
      list2:list2,
      list3:list3,
      list4:list4,
      list5:list5,
      list6:list6,
      list7:list7,
      ciga_data_all:ciga_data_all,
      evi_data_all:evi_data_all,
      evi_data_all_1:evi_data_all_1,
      ciga_data_t:ciga_data_t,
      evi_ciga_t:evi_ciga_t,
      ciga_data_f:ciga_data_f,
      evi_ciga_f:evi_ciga_f,
      tce_type_number_t_chinese:tce_type_number_t_chinese,
      tce_type_number_f_chinese:tce_type_number_f_chinese,
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-案件处理审批表.docx");
  });
}

//行政处罚事先告知书
export function export_word_15(
        tir_person,
        tir_id_number,
        tir_nation,
        tir_gender,
        tir_home,
        mer_hometown,
        retail_licence_code,
        illegal_behavior,
        punish_basis,
        tir_age,
        case_number,
        date_of_filing,
        year,
        month,
        day,
        violate_law,
        bureau_penalty,
        user_id_1,
        user_id_2,
        user_name_1,
        user_name_2,
        staff_license_no1,
        staff_license_no2,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/行政处罚事先告知书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      tir_person:tir_person,
      tir_id_number:tir_id_number,
      tir_nation:tir_nation,
      tir_gender:tir_gender,
      tir_home:tir_home,
      mer_hometown:mer_hometown,
      retail_licence_code:retail_licence_code,
      illegal_behavior:illegal_behavior,
      punish_basis:punish_basis,
      tir_age:tir_age,
      case_number:case_number,
      date_of_filing:date_of_filing,
      year:year,
      month:month,
      day:day,
      violate_law:violate_law,
      bureau_penalty:bureau_penalty,
      user_id_1:user_id_1,
      user_id_2:user_id_2,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      staff_license_no1:staff_license_no1,
      staff_license_no2:staff_license_no2,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-行政处罚事先告知书.docx");
  });
}


//行政处罚事先告知书送回达证
export function export_word_16(
        year,
        case_number,
        arrive_document_name,
        arrive_number,
        addressee,
        arrive_place,
        service_mode,
        receipt_signature,
        year1,
        month1,
        day1,
        hour1,
        min1,
        year2,
        month2,
        day2,
        hour2,
        min2,
        subsitute_reason,
        witness_signature,
        staff_name1,
        staff_license_no1,
        staff_name2,
        staff_license_no2,
        remarks
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/送达回证.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      case_number:case_number,
      arrive_document_name:arrive_document_name,
      arrive_number:arrive_number,
      addressee:addressee,
      arrive_place:arrive_place,
      service_mode:service_mode,
      receipt_signature:receipt_signature,
      year1:year1,
      month1:month1,
      day1:day1,
      hour1:hour1,
      min1:min1,
      year2:year2,
      month2:month2,
      day2:day2,
      hour2:hour2,
      min2:min2,
      subsitute_reason:subsitute_reason,
      witness_signature:witness_signature,
      staff_name1:staff_name1,
      staff_license_no1:staff_license_no1,
      staff_name2:staff_name2,
      staff_license_no2:staff_license_no2,
      remarks:remarks
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-行政处罚事先告知书送达回证.docx");
  });
}


//行政处罚决定书
export function export_word_17(
        illegal_behavior,
        year,
        month,
        day,
        case_number,
        tir_person,
        tir_gender,
        tir_nation,
        tir_age,
        mer_hometown,
        tir_id_number,
        retail_licence_code,
        mer_address,
        mer_name,
        tce_type_number_chinese,
        tce_number_chinese,
        year1,
        month1,
        day1,
        cigarette_origin,
        violate_law,
        num1,
        punish_basis,
        crime_number,
        tce_amount_chinese,
        tce_amount,
        penalty_decision,
        penalty_money,
        penalty_money_all,
        penalty_money_all_chinese,
        year2,
        month2,
        day2,
        tce_number_f_chinese,
        tce_number_t_chinese,
        list1,
        list2,
        list3,
        list4,
        list5,
        list6,
        list7,
        tce_type_number_t_chinese,
        tce_type_number_f_chinese,
        year3,
        month3,
        day3,
        hour3,
        min3,
        year4,
        month4,
        day4,
        finally_penalty,
        arrive_type,
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/行政处罚决定书.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      illegal_behavior:illegal_behavior,
      year:year,
      month:month,
      day:day,
      case_number:case_number,
      tir_person:tir_person,
      tir_gender:tir_gender,
      tir_nation:tir_nation,
      tir_age:tir_age,
      mer_hometown:mer_hometown,
      tir_id_number:tir_id_number,
      retail_licence_code:retail_licence_code,
      mer_address:mer_address,
      mer_name:mer_name,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      year1:year1,
      month1:month1,
      day1:day1,
      cigarette_origin:cigarette_origin,
      violate_law:violate_law,
      num1:num1,
      punish_basis:punish_basis,
      crime_number:crime_number,
      tce_amount_chinese:tce_amount_chinese,
      tce_amount:tce_amount,
      penalty_decision:penalty_decision,
      penalty_money:penalty_money,
      penalty_money_all:penalty_money_all,
      penalty_money_all_chinese:penalty_money_all_chinese,
      year2:year2,
      month2:month2,
      day2:day2,
      tce_number_f_chinese:tce_number_f_chinese,
      tce_number_t_chinese:tce_number_t_chinese,
      list1:list1,
      list2:list2,
      list3:list3,
      list4:list4,
      list5:list5,
      list6:list6,
      list7:list7,
      tce_type_number_t_chinese:tce_type_number_t_chinese,
      tce_type_number_f_chinese:tce_type_number_f_chinese,
      year3:year3,
      month3:month3,
      day3:day3,
      hour3:hour3,
      min3:min3,
      year4:year4,
      month4:month4,
      day4:day4,
      finally_penalty:finally_penalty,
      arrive_type:arrive_type,
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-行政处罚决定书.docx");
  });
}


//行政处罚事先告知书送回达证
export function export_word_18(
        year,
        case_number,
        arrive_document_name,
        arrive_number,
        addressee,
        arrive_place,
        service_mode,
        receipt_signature,
        year1,
        month1,
        day1,
        hour1,
        min1,
        year2,
        month2,
        day2,
        hour2,
        min2,
        subsitute_reason,
        witness_signature,
        staff_name1,
        staff_license_no1,
        staff_name2,
        staff_license_no2,
        remarks
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/送达回证.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      year:year,
      case_number:case_number,
      arrive_document_name:arrive_document_name,
      arrive_number:arrive_number,
      addressee:addressee,
      arrive_place:arrive_place,
      service_mode:service_mode,
      receipt_signature:receipt_signature,
      year1:year1,
      month1:month1,
      day1:day1,
      hour1:hour1,
      min1:min1,
      year2:year2,
      month2:month2,
      day2:day2,
      hour2:hour2,
      min2:min2,
      subsitute_reason:subsitute_reason,
      witness_signature:witness_signature,
      staff_name1:staff_name1,
      staff_license_no1:staff_license_no1,
      staff_name2:staff_name2,
      staff_license_no2:staff_license_no2,
      remarks:remarks
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-行政处罚决定书送达回证.docx");
  });
}

//涉案物品返还清单
export function export_word_19(
        case_number,
        list,
        ciga_number,
        identificate_loss,
        identificate_loss_chinese,
        returnee1,
        returnee2,
        staff_license_1,
        staff_license_2
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/涉案物品返还清单.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      case_number:case_number,
      list:list,
      ciga_number:ciga_number,
      identificate_loss:identificate_loss,
      identificate_loss_chinese:identificate_loss_chinese,
      returnee1:returnee1,
      returnee2:returnee2,
      staff_license_1:staff_license_1,
      staff_license_2:staff_license_2
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-涉案物品返还清单.docx");
  });
}

//行政处罚决定书
export function export_word_20(
        case_cause,
        case_time,
        investigators,
        final_address,
        illegal_behavior,
        year,
        month,
        day,
        case_number,
        tir_person,
        tir_gender,
        tir_nation,
        tir_age,
        mer_hometown,
        tir_id_number,
        retail_licence_code,
        mer_address,
        mer_name,
        tce_type_number_chinese,
        tce_number_chinese,
        year1,
        month1,
        day1,
        cigarette_origin,
        violate_law,
        num1,
        punish_basis,
        crime_number,
        tce_amount_chinese,
        tce_amount,
        penalty_decision,
        penalty_money,
        penalty_money_all,
        penalty_money_all_chinese,
        year2,
        month2,
        day2,
        tce_number_f_chinese,
        tce_number_t_chinese,
        list1,
        list2,
        list3,
        list4,
        list5,
        list6,
        list7,
        tce_type_number_t_chinese,
        tce_type_number_f_chinese,
        year3,
        month3,
        day3,
        hour3,
        min3,
        year4,
        month4,
        day4,
        finally_penalty,
        arrive_type,
        year5,
        month5,
        day5,
        return_ciga
){
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/结案报告表.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      case_cause:case_cause,
      case_time:case_time,
      investigators:investigators,
      final_address:final_address,
      illegal_behavior:illegal_behavior,
      year:year,
      month:month,
      day:day,
      case_number:case_number,
      tir_person:tir_person,
      tir_gender:tir_gender,
      tir_nation:tir_nation,
      tir_age:tir_age,
      mer_hometown:mer_hometown,
      tir_id_number:tir_id_number,
      retail_licence_code:retail_licence_code,
      mer_address:mer_address,
      mer_name:mer_name,
      tce_type_number_chinese:tce_type_number_chinese,
      tce_number_chinese:tce_number_chinese,
      year1:year1,
      month1:month1,
      day1:day1,
      cigarette_origin:cigarette_origin,
      violate_law:violate_law,
      num1:num1,
      punish_basis:punish_basis,
      crime_number:crime_number,
      tce_amount_chinese:tce_amount_chinese,
      tce_amount:tce_amount,
      penalty_decision:penalty_decision,
      penalty_money:penalty_money,
      penalty_money_all:penalty_money_all,
      penalty_money_all_chinese:penalty_money_all_chinese,
      year2:year2,
      month2:month2,
      day2:day2,
      tce_number_f_chinese:tce_number_f_chinese,
      tce_number_t_chinese:tce_number_t_chinese,
      list1:list1,
      list2:list2,
      list3:list3,
      list4:list4,
      list5:list5,
      list6:list6,
      list7:list7,
      tce_type_number_t_chinese:tce_type_number_t_chinese,
      tce_type_number_f_chinese:tce_type_number_f_chinese,
      year3:year3,
      month3:month3,
      day3:day3,
      hour3:hour3,
      min3:min3,
      year4:year4,
      month4:month4,
      day4:day4,
      finally_penalty:finally_penalty,
      arrive_type:arrive_type,
      year5:year5,
      month5:month5,
      day5:day5,
      return_ciga:return_ciga
    });
    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }
    //生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, case_number+"-结案报告表.docx");
  });
}

//现场询问笔录打印
export function export_word_21(
        inquiry_time,
        tce_address,
        user_id_1,
        user_id_2,
        user_name_1,
        user_name_2,
        recorder,
        staff_license_1,
        staff_license_2,
        tir_person,
        tir_gender,
        tir_nation,
        tir_id_number,
        tir_home,
        address,
        tel,
        confirm_record,
        inform_right,
        tir_person_answer,
        question_answer_list,
        end_confirm
) {
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/勘验笔录现场询问.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      inquiry_time:inquiry_time,
      tce_address:tce_address,
      user_id_1:user_id_1,
      user_id_2:user_id_2,
      user_name_1:user_name_1,
      user_name_2:user_name_2,
      recorder:recorder,
      staff_license_1:staff_license_1,
      staff_license_2:staff_license_2,
      tir_person:tir_person,
      tir_gender:tir_gender,
      tir_nation:tir_nation,
      tir_id_number:tir_id_number,
      tir_home:tir_home,
      address:address,
      tel:tel,
      confirm_record:confirm_record,
      inform_right:inform_right,
      tir_person_answer:tir_person_answer,
      question_answer_list:question_answer_list,
      end_confirm:end_confirm,
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "勘验笔录现场询问记录.docx");
  });
}

//卷烟产品鉴别检验抽样单打印
export function export_word_22(
        tir_person,
        tir_telephone,
        tir_address,
        sampling_unit,
        sampling_person1_name,
        sampling_person2_name,
        sampling_address,
        client,
        telephone,
        portraiture,
        postal_code,
        client_address,
        sample_ciga_Data,
        year,
        month,
        day
) {
  // 读取并获得模板文件的二进制内容
  JSZipUtils.getBinaryContent("../src/components/卷烟产品鉴别检验抽样单.docx", function(error, content) {
    // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
    // 抛出异常
    if (error) {
      throw error;
    }
    // 创建一个PizZip实例，内容为模板的内容
    let zip = new PizZip(content);

    // 创建并加载docxtemplater实例对象
    let doc = new Docxtemplater().loadZip(zip);
    // 设置模板变量的值
    doc.setData({
      tir_person:tir_person,
      tir_telephone:tir_telephone,
      tir_address:tir_address,
      sampling_unit:sampling_unit,
      name1:sampling_person1_name,
      name2:sampling_person2_name,
      sampling_address:sampling_address,
      client:client,
      telephone:telephone,
      portraiture:portraiture,
      postal_code:postal_code,
      client_address:client_address,
      list:sample_ciga_Data,
      y:year,
      m:month,
      d:day
    });

    try {
      // 用模板变量的值替换所有模板变量
      doc.render();
    } catch (error) {
      // 抛出异常
      let e = {
        message: error.message,
        name: error.name,
        stack: error.stack,
        properties: error.properties
      };
      console.log(JSON.stringify({ error: e }));
      throw error;
    }

    // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
    let out = doc.getZip().generate({
      type: "blob",
      mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    });
    // 将目标文件对象保存为目标类型的文件，并命名
    saveAs(out, "卷烟产品鉴别检验抽样单.docx");
  });
}
// //卷烟产品鉴别检验抽样单打印
// export function export_word_23(
//         client_address,
//         postal_code,
//         contact_person_name,
//         telephone,
//         portraiture,
//         year,
//         month,
//         day,
//         sampling_person1_name,
//         sampling_person2_name,
//         handle_person_name,
//         sampling_unit,
//         tir_address,
//         sample_ciga_Data,
//         sample_state_describe,
//         inspection_station_name,
//         inspection_station_address,
//         inspection_station_telephone,
//         inspection_station_portraiture,
//         inspection_station_postcode,
//         remarks
// ) {
//   // 读取并获得模板文件的二进制内容
//   JSZipUtils.getBinaryContent("../src/components/卷烟产品鉴别检验委托协议书.xls", function(error, content) {
//     // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
//     // 抛出异常
//     if (error) {
//       throw error;
//     }
//     // 创建一个PizZip实例，内容为模板的内容
//     let zip = new PizZip(content);
//
//     // 创建并加载docxtemplater实例对象
//     let doc = new Docxtemplater().loadZip(zip);
//     // 设置模板变量的值
//     doc.setData({
//       client_address:client_address,
//       postal_code:postal_code,
//       contact_person_name:contact_person_name,
//       telephone:telephone,
//       portraiture:portraiture,
//       year:year,
//       month:month,
//       day:day,
//       sampling_person1_name:sampling_person1_name,
//       sampling_person2_name:sampling_person2_name,
//       handle_person_name:handle_person_name,
//       sampling_unit:sampling_unit,
//       tir_address:tir_address,
//       sample_ciga_Data:sample_ciga_Data,
//       sample_state_describe:sample_state_describe,
//       inspection_station_name:inspection_station_name,
//       inspection_station_address:inspection_station_address,
//       inspection_station_telephone:inspection_station_telephone,
//       inspection_station_portraiture:inspection_station_portraiture,
//       inspection_station_postcode:inspection_station_postcode,
//       remarks:remarks
//     });
//
//     try {
//       // 用模板变量的值替换所有模板变量
//       doc.render();
//     } catch (error) {
//       // 抛出异常
//       let e = {
//         message: error.message,
//         name: error.name,
//         stack: error.stack,
//         properties: error.properties
//       };
//       console.log(JSON.stringify({ error: e }));
//       throw error;
//     }
//
//     // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
//     let out = doc.getZip().generate({
//       type: "blob",
//       mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
//     });
//     // 将目标文件对象保存为目标类型的文件，并命名
//     saveAs(out, "卷烟产品鉴别检验委托协议书.xls");
//   });
// }




export function s2ab(s) {
      const buf = new ArrayBuffer(s.length);
      const view = new Uint8Array(buf);
      for (let i = 0; i < s.length; i++) {
        view[i] = s.charCodeAt(i) & 0xff;
      }
      return buf;
}

export async function export_word_23(
        client_address,
        postal_code,
        contact_person_name,
        telephone,
        portraiture,
        // year,
        // month,
        // day,
        // sampling_person1_name,
        // sampling_person2_name,
        handle_person_name,
        sampling_unit,
        tir_address,
        // sample_ciga_Data,
        sample_state_describe,
        inspection_station_name,
        inspection_station_address,
        inspection_station_telephone,
        inspection_station_portraiture,
        inspection_station_postcode,
        remarks
) {
  //load the template file
  // const templateFile = XLSX.readFile('../src/components/卷烟产品鉴别检验委托协议书.xls');
  const workbook = new ExcelJS.Workbook();
  await workbook.xlsx.readFile('../src/components/卷烟产品鉴别检验委托协议书.xls');
  const worksheet = workbook.getWorksheet('Sheet1');
  // // get the first worksheet
  // const worksheet = templateFile.Sheets[templateFile.SheetNames[0]];
  worksheet['C6'].v = client_address;
  worksheet['L6'].v = postal_code;
  worksheet['C7'].v=contact_person_name;
  worksheet['G7'].v=telephone;
  worksheet['L7'].v=portraiture;
  // worksheet['B8'].v=year+"."+month+"."+day;
  // worksheet['D8'].v=sampling_person1_name+"、"+sampling_person2_name;
  worksheet['M8'].v=handle_person_name;
  worksheet['B9'].v=sampling_unit;
  worksheet['H9'].v=tir_address;
  worksheet['B26'].v=sample_state_describe;
  worksheet['C28'].v=inspection_station_name;
  worksheet['I28'].v=inspection_station_address;
  worksheet['C29'].v=inspection_station_telephone;
  worksheet['H29'].v=inspection_station_portraiture;
  worksheet['N29'].v=inspection_station_postcode;
  worksheet['B35'].v=remarks;
  alert(worksheet)
  // // create a new workbook with the filled-in data
  // const workbook = XLSX.utils.book_new();
  // XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
  //
  // // save the workbook as a file
  // const fileData = XLSX.write(workbook, { type: 'binary' });
  // const fileName = '卷烟产品鉴别检验委托协议书.xls';
  // const buf = new ArrayBuffer(fileData.length);
  // const view = new Uint8Array(buf);
  // for (let i = 0; i < s.length; i++) {
  //   view[i] = fileData.charCodeAt(i) & 0xff;
  // }
  // // saveAs(fileData, "卷烟产品鉴别检验委托协议书.xls");
  // saveAs(new Blob([s2ab(fileData)], { type: 'application/octet-stream' }), fileName);
  // const workbook = new ExcelJS.Workbook();
  // await workbook.xlsx.readFile('../src/components/卷烟产品鉴别检验委托协议书.xls');
  // const worksheet = workbook.getWorksheet('Sheet1');
  //
  // //Update values in the template
  // worksheet.getCell('C6').value  = client_address;
  // worksheet.getCell('L6').value  = postal_code;
  // worksheet.getCell('C7').value =contact_person_name;
  // worksheet.getCell('G7').value =telephone;
  // worksheet.getCell('L7').value =portraiture;
  // // worksheet.getCell('B8').value =year+"."+month+"."+day;
  // // worksheet.getCell('D8').value =sampling_person1_name+"、"+sampling_person2_name;
  // worksheet.getCell('M8').value =handle_person_name;
  // worksheet.getCell('B9').value =sampling_unit;
  // worksheet.getCell('H9').value =tir_address;
  // worksheet.getCell('B26').value =sample_state_describe;
  // worksheet.getCell('C28').value =inspection_station_name;
  // worksheet.getCell('I28').value =inspection_station_address;
  // worksheet.getCell('C29').value =inspection_station_telephone;
  // worksheet.getCell('H29').value =inspection_station_portraiture;
  // worksheet.getCell('N29').value =inspection_station_postcode;
  // worksheet.getCell('B35').value =remarks;
  // // Create a buffer and write the workbook to it
  // const buffer = await workbook.xlsx.writeBuffer();
  //
  // // Save the buffer to a file or display the file for download
  // const blob = new Blob([buffer], {type: 'applicationnd.openxmlformats-officedocument.spreadsheetml.sheet'});
  // const url = window.URL.createObjectURL(blob);
  // const link = document.createElement('a');
  // link.href = url;
  // link.setAttribute('download', '卷烟产品鉴别检验委托协议书.xls');
  // document.body.appendChild(link);
  // link.click();
}

// export default {
//   data() {
//     return {
//       name: '',
//       age: null,
//     };
//   },
//
//   methods: {
//     exportExcel() {
//       // load the template file
//       const templateFile = XLSX.readFile('path/to/template.xlsx');
//
//       // get the first worksheet
//       const worksheet = templateFile.Sheets[templateFile.SheetNames[0]];
//       worksheet['C6'].v = this.name;
//       worksheet['A2'].v = this.age;
//
//       // create a new workbook with the filled-in data
//       const workbook = XLSX.utils.book_new();
//       XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
//
//       // save the workbook as a file
//       const fileData = XLSX.write(workbook, { type: 'binary' });
//       const fileName = 'output.xlsx';
//       saveAs(new Blob([this.s2ab(fileData)], { type: 'application/octet-stream' }), fileName);
//     },
//
//     s2ab(s) {
//       const buf = new ArrayBuffer(s.length);
//       const view = new Uint8Array(buf);
//       for (let i = 0; i < s.length; i++) {
//         view[i] = s.charCodeAt(i) & 0xff;
//       }
//       return buf;
//     },
//   },
// };


export default {
  name: "table_inquiry.vue",
  data(){
  },
  methods:{
    // 点击导出word
    exportWord: function() {
      let that = this;
      // 读取并获得模板文件的二进制内容
      JSZipUtils.getBinaryContent("../src/components/批准书.docx", function(error, content) {
        // model.docx是模板。我们在导出的时候，会根据此模板来导出对应的数据
        // 抛出异常
        if (error) {
          throw error;
        }
        // 创建一个PizZip实例，内容为模板的内容
        let zip = new PizZip(content);
        // 创建并加载docxtemplater实例对象
        let doc = new Docxtemplater().loadZip(zip);
        // 设置模板变量的值
        doc.setData({
          case_id : "12121212",
          case_cause:"售卖假烟"
        });

        try {
          // 用模板变量的值替换所有模板变量
          doc.render();
        } catch (error) {
          // 抛出异常
          let e = {
            message: error.message,
            name: error.name,
            stack: error.stack,
            properties: error.properties
          };
          console.log(JSON.stringify({ error: e }));
          throw error;
        }

        // 生成一个代表docxtemplater对象的zip文件（不是一个真实的文件，而是在内存中的表示）
        let out = doc.getZip().generate({
          type: "blob",
          mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        });
        // 将目标文件对象保存为目标类型的文件，并命名
        saveAs(out, "证据先行保存批准书.docx");
      });
    }
  }
}





</script>

<style scoped>

</style>